﻿using System;
using Me.Amon.Da.Db;
using Me.Amon.M;
using Me.Amon.Util;

namespace Me.Amon.KPT
{
    public partial class WKpt : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            //var user = WebUtil.CurrentUser(Session);
            //if (user.Rank < IUser.LEVEL_01)
            //{
            //    Response.Redirect("/KPT/Index.aspx");
            //    return;
            //}

            //LlUser.Visible = true;
            //LbUser.Visible = true;

            //HlUser.Text = user.Name;
            //HlUser.ToolTip = "我的首页";
            //HlUser.NavigateUrl = "~/User/Index.aspx";
            //HfUser.Value = user.UserId;
        }

        protected void LbSignIn_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/User/SignIn.aspx");
        }

        protected void LbSignOf_Click(object sender, EventArgs e)
        {
            MUser user = WebUtil.CurrentUser(Session);
            if (user.Code == IUser.DEMO_CODE)
            {
                var dba = new RDBEngine();
                dba.AddTable(DBConst.C3010A00);
                dba.AddWhere(DBConst.C3010A03, IUser.DEMO_CODE);
                dba.ExecuteDelete();
            }

            user.WpSignOf();

            Response.Redirect(IEnv.HOME_PAGE);
        }
    }
}